package com.itheima.stock.dto;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentFontStyle;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * @author zby
 * @created 2024-06-29 10:14
 * @description 处理导出Excel 文件
 */
@Data
@HeadRowHeight(value = 20)
@ColumnWidth(value = 20)
@ContentRowHeight(value = 15)
@ContentFontStyle(fontName = "Microsoft YaHei")
public class StockInfoExcelDTO {

    /**
     * 编号
     */
    @ExcelProperty(value = "编号", index = 0)
    private int num;


    /**
     * 股票代码
     */
    @ExcelProperty(value = "股票代码", index = 1)
    private String code;


    /**
     * 股票名称
     */
    @ExcelProperty(value = "股票名称", index = 2)
    private String name;
    /**
     * 交易量
     */
    @ExcelProperty(value = "成交量", index = 3)
    private Long tradeAmt;
    /**
     * 前收盘价
     */
    @ExcelProperty(value = "前收盘价", index = 4)
    private BigDecimal preClosePrice;
    /**
     * 振幅
     */
    @ExcelProperty(value = "振幅", index = 5)
    private BigDecimal amplitude;


    /**
     * 交易额 （万元）
     */
    @ExcelProperty(value = "交易额", index = 6)
    private BigDecimal tradeVol;
    /**
     * 涨幅
     * 计算公式：当前价格-前收盘价/前收盘价 * 100%
     */
    @ExcelProperty(value = "涨幅", index = 7)
    private BigDecimal increase;
    /**
     * 涨跌 ：
     * 计算公式： 当前价格-前收盘价
     */
    @ExcelProperty(value = "涨跌值", index = 8)
    private BigDecimal upDown;
    /**
     * 交易价格（当前价）
     */
    @ExcelProperty(value = "当前价格", index = 9)
    private BigDecimal tradePrice;

    /**
     * 当前日期（20230304）
     */
    @ExcelProperty(value = "日期", index = 10)
    @DateTimeFormat(value = "yyyy年MM月dd日")
    private LocalDate curDate;

}
